.\"	$OpenBSD: CRYPTO_get_mem_functions.3,v 1.7 2019/06/10 09:49:48 schwarze Exp $
.\"
.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: June 10 2019 $
.Dt CRYPTO_GET_MEM_FUNCTIONS 3
.Os
.Sh NAME
.Nm CRYPTO_get_mem_functions ,
.Nm CRYPTO_set_mem_functions ,
.Nm CRYPTO_mem_ctrl ,
.Nm CRYPTO_mem_leaks ,
.Nm CRYPTO_mem_leaks_fp ,
.Nm CRYPTO_mem_leaks_cb
.Nd legacy OpenSSL memory allocation control
.Sh SYNOPSIS
.In openssl/crypto.h
.Ft void
.Fo CRYPTO_get_mem_functions
.Fa "void *(**m)(size_t)"
.Fa "void *(**r)(void *, size_t)"
.Fa "void (**f)(void *)"
.Fc
.Ft int
.Fo CRYPTO_set_mem_functions
.Fa "void *(*m)(size_t)"
.Fa "void *(*r)(void *, size_t)"
.Fa "void (*f)(void *)"
.Fc
.Ft int
.Fo CRYPTO_mem_ctrl
.Fa "int mode"
.Fc
.Ft int
.Fo CRYPTO_mem_leaks
.Fa "BIO *b"
.Fc
.Ft int
.Fo CRYPTO_mem_leaks_fp
.Fa "FILE *fp"
.Fc
.Ft typedef int *
.Fo CRYPTO_MEM_LEAK_CB
.Fa "unsigned long"
.Fa "const char *"
.Fa int
.Fa int
.Fa "void *"
.Fc
.Ft int
.Fo CRYPTO_mem_leaks_cb
.Fa "CRYPTO_MEM_LEAK_CB *cb"
.Fc
.Sh DESCRIPTION
Do not use any of the interfaces documented here.
They are provided purely for compatibility with legacy application code.
.Pp
.Fn CRYPTO_get_mem_functions
assigns pointers to the C library functions
.Xr malloc 3 ,
.Xr realloc 3 ,
and
.Xr free 3
to those of its arguments that are not
.Dv NULL .
.Pp
.Fn CRYPTO_set_mem_functions ,
.Fn CRYPTO_mem_ctrl ,
.Fn CRYPTO_mem_leaks ,
.Fn CRYPTO_mem_leaks_fp ,
and
.Fn CRYPTO_mem_leaks_cb
have no effect.
.Sh RETURN VALUES
.Fn CRYPTO_set_mem_functions
always returns 0.
.Pp
.Fn CRYPTO_mem_ctrl
always returns
.Dv CRYPTO_MEM_CHECK_OFF .
.Pp
.Fn CRYPTO_mem_leaks ,
.Fn CRYPTO_mem_leaks_fp ,
and
.Fn CRYPTO_mem_leaks_cb
always return -1.
.Sh SEE ALSO
.Xr crypto 3
.Sh HISTORY
.Fn CRYPTO_mem_ctrl ,
.Fn CRYPTO_mem_leaks ,
and
.Fn CRYPTO_mem_leaks_fp
first appeared in SSLeay 0.6.4.
.Fn CRYPTO_get_mem_functions
and
.Fn CRYPTO_set_mem_functions
first appeared in SSLeay 0.6.5.
.Fn CRYPTO_mem_leaks_cb
first appeared in SSLeay 0.6.6.
All these functions have all been available since
.Ox 2.4 .
